/**
 * Created by zhangqingxi on 2017-04-06.
 */
var modelPath=ROOT_PATH+'/environmental/monitor/registration/';


//初始化异常状态
function initAbnormalState() {
    $('#abnormalState').combobox({
        data:[{"id":0,"text":"否"},{"id":1,"text":"是"}],
        valueField:'id',
        textField:'text',
        panelHeight:'auto',
        editable:false,
        required:true
    });
}
//初始化监测点
function initMonitorPoint() {
    $('#monitorPointId').combogrid({
        required:true,
        editable:false,
        readonly:false,
        panelWidth:500,
        prompt:'请选择',
        idField:'id',
        textField:'code',
        queryParams:{
            sort:'d.addTime',
            order:'desc'
        },
        fitColumns:true,
        pagination:true,
        rownumbers:true,
        singleSelect:true,
        sortOrder:true,
        striped:true,
        url:findMonitoringPoint,
        columns:[[
            {field:'name',title:'监测点名称',width:10},
            {field:'contaminantsTypeName',title:'污染物类型',width:10,sortable:false},
            {field:'controlLevelName',title:'控制级别',width:10,sortable:false}
        ]],
        onSelect:function (index, row) {
            $('#monitorProjectId').combobox({
                value:''
            });
            initMonitorProject(row.id)
        }
    });
}
//初始化检测项目
function initMonitorProject(pointId) {
    $('#monitorProjectId').combobox({
        url:findMonitorProject+pointId,
        prompt:'请选择',
        required:true,
        editable:false,
        valueField:'id',
        textField:'text'
    });
}

function monitorPointLoadSuccess() {
    $val=$('#monitorPointId').val();
    initMonitorProject($val)
}
